<!--
 * @FileDescription: 公共弹窗组件
 * @Author: 祝小文
 * @Date: 2022-10-14 15:04
 -->
<template>
  <div class="dialog-container">
    <div class="dialog-box">
      <!-- 头部标题 -->
      <div class="dialog-top-title">{{ props.title }}</div>

      <!-- 内容 -->
      <div class="dialog-main">
        <slot></slot>
      </div>

      <!-- 底部按钮 -->
      <div class="dialog-bottom-btn">
        <el-button type="info" @click="cancelClick">取&nbsp;&nbsp;消</el-button>
        <el-button type="info" style="margin: 0 65px" @click="resetClick"
          >重&nbsp;&nbsp;置</el-button
        >
        <el-button type="info" style="background: #02979b" @click="saveClick"
          >保&nbsp;&nbsp;存</el-button
        >
      </div>
    </div>
  </div>
</template>

<script lang="ts" setup>
const props = defineProps({
  title: {
    type: String,
    default: '',
  },
})

// 声明事件
const emit = defineEmits(['cancelClick', 'resetClick', 'saveClick'])

/** 取消 */
const cancelClick = () => {
  emit('cancelClick')
}
/** 重置 */
const resetClick = () => {
  emit('resetClick')
}
/** 保存 */
const saveClick = () => {
  emit('saveClick')
}
</script>

<style lang="less">
.dialog-container {
  position: absolute;
  top: 112px;
  left: 50%;
  transform: translateX(-50%);
  width: 700px;
  height: calc(100% - 122px);
  padding: 5px 8px 7px 9px;
  background: rgba(1, 7, 17, 0.7);
  border: 1px solid #0d609c;
  box-sizing: border-box;
  z-index: 9;

  .dialog-box {
    height: 100%;
    background: rgba(1, 7, 17, 0.8);
  }
  .dialog-top-title {
    height: 45px;
    line-height: 45px;
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    color: #fff;
    border-bottom: 1px solid #6d6d6d;
    margin-bottom: 10px;
  }

  .dialog-main {
    height: calc(100% - 121px);
    padding: 0 10px;
    overflow: hidden;
    overflow-y: auto;
  }

  .dialog-bottom-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 17px 0;
    .el-button {
      width: 140px;
      height: 30px;
      font-size: 18px;
      background: #778082;
      border: 0;
      border-radius: 10px;
      cursor: pointer;
    }
  }

  .el-form {
    padding: 0 12px 12px 10px;
    .el-input__wrapper {
      border: 1px solid #6d6d6d;
      background: rgba(109, 109, 109, 0.2);
    }
    .el-form-item__label {
      line-height: unset;
      align-items: center;
      padding-left: unset !important;
      color: #fff;
      font-size: 16px;
    }
    .el-input__inner {
      padding-left: 5px;
    }
  }
}
</style>
